var PITCHWISE = PITCHWISE || {};
PITCHWISE.home = PITCHWISE.home || {};

PITCHWISE.home = function (options) {
    'use strict';

    //this.authenticated = options.authenticated;
    this.el = {
        'promos':$('[promo-id]')
    };

    this.promoCount = 0;
    this.promoCurrent = 0;
    this.interval;

    console.log('PITCHWISE.home.options', options);
    this.load();
};
PITCHWISE.home.prototype.events = function () {

};

PITCHWISE.home.prototype.promoSwitch = function () {
    var _this = this;
    if ($('[promo-id='+ _this.promoCount +']').length == 0) {
        _this.promoCount = 0;
    }

    $('[promo-id='+ _this.promoCurrent +']').fadeOut(2000);
    $('[promo-id='+ _this.promoCount +']').fadeIn(2000);

    _this.promoCurrent = _this.promoCount;
    _this.promoCount++;
};

PITCHWISE.home.prototype.init = function () {
    var _this = this;

    this.el.promos.hide();

    _this.promoSwitch();
    this.interval = setInterval(function () {
        _this.promoSwitch();
    },6000);
};

PITCHWISE.home.prototype.load = function () {
    this.events();
    this.init();
};